import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Test {

	public static void main(String[] args) {

		String src = "C:/dev/workspace/xprs5/eclipse/workspace/jimage/test/dp_24.bmp";
		String dst = "C:/dev/workspace/xprs5/eclipse/workspace/jimage/test/dst.bmp";
		String dst_gray = "C:/dev/workspace/xprs5/eclipse/workspace/jimage/test/dst_gray.bmp";
		
		InputStream in = null;
		OutputStream out = null;
		OutputStream out_gray = null;
		try {
			in = new java.io.FileInputStream(src);
			out = new java.io.FileOutputStream(dst);
			out_gray = new java.io.FileOutputStream(dst_gray);
			
			BMP bmp = new BMP();
			bmp.read(in);
			
			bmp.copy(out);
			
//			bmp.saveAsGray(out_gray);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (in != null) {
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			if (out != null) {
				try {
					out.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
